//package com.henry.chatkit.demo
//
//import android.view.LayoutInflater
//import android.view.View
//import android.view.ViewGroup
//import android.widget.RelativeLayout
//import android.widget.TextView
//import com.alibaba.fastjson.JSON
//import com.henry.chatkit.messages.CustomMessageViewGroup
//import com.henry.chatkit.messages.Message
//import com.henry.chatkit.messages.MessageType
//import com.henry.chatkit.messages.OnCustomMessageDrawListener
//import com.henry.chatkit.utils.appActivity
//import com.henry.chatkit.utils.log
//
//class CustomMessageDraw : OnCustomMessageDrawListener {
//
//    override fun onDraw(parent: CustomMessageViewGroup?, msg: Message?) {
//
//        val customMessage: CustomMessage = JSON.parseObject(msg?.data, CustomMessage::class.java)
//        when (customMessage.customType) {
//            0 -> {
//                val view: View = LayoutInflater.from(appActivity()).inflate(R.layout.chat_custom_system_message, null, false)
//                parent?.addMessageItemView(view)
//
//                // TODO xml居中不好使
//                val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
//                params.addRule(RelativeLayout.CENTER_IN_PARENT)
//                view.layoutParams = params
//
//                val titleLabel = view.findViewById<TextView>(R.id.tv_custom_title)
//                titleLabel.text = customMessage.typeName
//
//                val timeLabel = view.findViewById<TextView>(R.id.chat_time_tv)
//                parent?.updateTime(timeLabel)
//
//            }
//            else -> {
//                val view: View = LayoutInflater.from(appActivity()).inflate(R.layout.chat_custom_message, null, false)
//                parent?.addMessageContentView(view)
//                parent?.getContentFrame()?.background = null
//                parent?.getContentFrame()?.setPadding(8, 0, 8, 0)
//
//                val titleLabel = view.findViewById<TextView>(R.id.tv_custom_title)
//                titleLabel.text = customMessage.typeName
//            }
//        }
//
//    }
//}